
public class Enemy {
	String name;
	String type;
	int life;
	int attack;
	int defense;
	int aglie;
	boolean isDead;
	int getExp;//得到经验
	//
	public Enemy(String name,String type) {
		this.type = type;
		this.isDead = false;
		if(type.equals("僵尸")) {
			this.name = name+"的僵尸";
			this.life = 30;
			this.attack = 15;
			this.defense = 10;
			this.aglie = 5;
			this.getExp = 20;
		} else if(type.equals("吸血鬼")) {
			this.name = name+"的吸血鬼";
			this.life = 35;
			this.attack = 18;
			this.defense = 5;
			this.aglie = 7;
			this.getExp = 25;
		} else if(type.equals("狼人")) {
			this.name = name+"的狼人";
			this.life = 25;
			this.attack = 12;
			this.defense = 14;
			this.aglie = 2;
			this.getExp = 25;
		} else if(type.equals("Boss")) {
			this.name = name;
			this.life = 100;
			this.attack = 38;
			this.defense = 17;
			this.aglie = 4;
			this.getExp = 120;
		}
	}
	
	public void show() {
		System.out.println("************************************************************************************");
		System.out.println("敌人:"+this.name);
		System.out.println("\t生命:"+this.life+"\t攻击:"+this.attack+"\t防御:"+this.defense+"\t敏捷:"+this.aglie);
		System.out.println("************************************************************************************");
	}
	
	public void injured(Player p,int damage) {
		//口号
		System.out.println("####"+this.name+":大叫一声，敢打我！"+damage);
		//减少生命
		this.life-=damage;
		//判断是否死亡
		if(this.life<=0) {
			System.out.println("####"+this.name+":天要亡我!哇啊啊啊啊啊!");
			this.isDead = true;
			return;
		}
		//反击和口号
		if(type.equals("Boss")) {
			System.out.println("####"+this.name+":区区小伤，何足挂齿，受我一斧!");
		} else {
			System.out.println("####"+this.name+":小样！敢打我，看招!");
		}
		int td = this.attack - p.defense;
		if(td<=0) {
			td = 1;
		}
		//让玩家受伤
		p.injured(td);
	}
}
